package com.biannuo.szk.community.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biannuo.szk.community.dao.entity.BlogDO;
import com.biannuo.szk.community.dao.mapper.BlogMapper;
import com.biannuo.szk.community.service.IBlogService;
import com.biannuo.szk.community.service.dto.BlogDTO;
import com.biannuo.szk.community.service.wrapper.BlogWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * 博客表
 *
 * @Entity com.innovation.desk.domain.Blog
 */
@Component
public class BlogServiceImpl extends ServiceImpl<BlogMapper, BlogDO> implements IBlogService {

//    @Autowired
    private BlogWrapper blogWrapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saveBlog(BlogDTO blogDTO) {
        BlogDO blogDO = blogWrapper.toEntity(blogDTO);

    }

    @Override
    public void removeBlog(Long id, Long userId) {

    }

    @Override
    public void updateBlog(BlogDTO blogDTO) {

    }

    @Override
    public BlogDTO getBlog(Long id, Long userId) {
        return null;
    }

    @Override
    public IPage<BlogDTO> listBlog(IPage page, String title) {
        IPage<BlogDTO> pageBlog = baseMapper.getAllBlogList(page, title);

        return pageBlog;
    }
}
